﻿CREATE TABLE [Mapping].[MappingGroup]
(
  [Id] INT NOT NULL PRIMARY KEY NONCLUSTERED IDENTITY, 
  [GroupName] NVARCHAR(50) NOT NULL, 
  [SourceSystem] INT NULL, 
  [AlternateKeyType] nvarchar(20) NULL,
  [RuntimeView] NVARCHAR(50) NULL,
  [RuntimeViewHash] INT NULL,
  [Description] NVARCHAR(200) NULL,
  CONSTRAINT [FK_MappingGroup_SourceSystem] FOREIGN KEY ([SourceSystem]) REFERENCES [Mapping].[SourceSystem]([Id]) ON DELETE CASCADE
)

GO
CREATE UNIQUE CLUSTERED INDEX [IX_MappingGroup_GroupName] ON [Mapping].[MappingGroup] ([GroupName])